﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.Unity;

namespace ERPStore
{
	internal class DefaultServicesContainer : IServicesContainer
	{
		private readonly Microsoft.Practices.Unity.IUnityContainer m_Container;

		public DefaultServicesContainer(Microsoft.Practices.Unity.IUnityContainer container)
		{
			m_Container = container;
		}

		#region IServiceContainer Members

		public void Add(Type serviceType, object service)
		{
			m_Container.RegisterInstance(serviceType, service, new ContainerControlledLifetimeManager());
		}

		public void Replace(Type serviceType, object service)
		{
			m_Container.RegisterInstance(serviceType, service);
		}

		#endregion

	}
}
